<?php
/**
 * Template Name: Release Template
 * Description: A Page Template that has not pagead
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */

get_header(); ?>

		<div id="primary" class="pagedefault">
			<div id="content" role="main" class="clearfix">

				
					<div class="leftpage aleft">
	<?php

		if(has_post_thumbnail()) {the_post_thumbnail('page-thumb');
		} else { ?>
				<img src="<?php echo get_template_directory_uri(); ?>/images/page-thumb.jpg" alt="<?php the_title();?>"/>
	<?php } //endif?>
	<?php //if(function_exists('cpMenu')) cpMenu(array('depth' => 2)); ?>
	<?php if ( get_field('menu_name') ) : ?>
		<?php 
			$args = array(
					'menu'		        => get_field('menu_name'), 
					'container'       	=> false, 
					'menu_class'		=> 'pagemenu'
					);
			echo wp_nav_menu($args); 
		?>
	<?php endif; ?>
</div><!--/.leftpage-->

<div class="mainpage aleft">
	<?php while ( have_posts() ) : the_post(); ?>
	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
		<header class="entry-header">
			<h1 class="entry-title"><?php the_title(); ?></h1>
		</header><!-- .entry-header -->
	
		<div class="entry-content">
			<?php the_content(); ?>
			
			<?php
				$args = array(
					'post_type'=> 'pressroom',
					'posts_per_page' => 1,
				);
				query_posts( $args );
			?>
			<?php if ( have_posts() ) {?>
			<?php while (have_posts()) : the_post();?>
			<br/><br/>
			<h2 class="hd-tb">Featured News Release</h2>
			<div class="bd-tb clearfix">
			<?php if((get_field('news_type')=='Featured')&&(get_field('is_approved')=='Yes')):?>
				<div class="aright">
					<?php
				
						if(has_post_thumbnail()) {the_post_thumbnail('stick-thumb');
						} else { ?>
								<img src="<?php echo get_template_directory_uri(); ?>/images/stick-thumb.gif" alt="<?php the_title();?>"/>
					<?php } //endif?>
				</div>
		
				<div class="aleft rfeatured">
					<p class="rdate"><?php the_date('M d, Y');?></p><br/>
					<p class="rtitle"><?php the_title(); ?></p><br/>
					<div class="rexcerpt"><?php the_field('summary'); ?></div><br/>
					<a class="rmore" href="<?php the_permalink()?>">Read more</a>	
				</div>
			<?php endif;?>
			</div>
			<?php endwhile;
				wp_reset_query();// Reset Query
			?>
			<?php }; //endif?>
			
	
			<?php 
			$args = array(
							'post_type'=> 'pressroom',
							'order'    => 'DESC',
							'orderby' => 'date',
							'posts_per_page' => -1,
							
						);
			query_posts( $args );
			// the Loop
			if ( have_posts() ) {?>
			<br/><br/>
			<h2 class="hd-tb"> Recent News Releases</h2>
			<div class="bd-tb">
				<?php while (have_posts()) : the_post();?>
				<?php if((get_field('news_type')=='Release')&&(get_field('is_approved')=='Yes')):?>
					<p class="rdate"><?php the_time('M j, Y'); ?></p>
					<p class="rtitle"><?php the_title(); ?></p>
					<div class="rexcerpt"><?php the_field('summary'); ?></div><br/>
					<a class="rmore" href="<?php the_permalink()?>">Read more</a><br/>
					<div class="line-tb"></div>
				<?php endif; ?>
				<?php endwhile;
					wp_reset_query();// Reset Query
				?>
			</div>
			<?php }; //endif?>
			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
		</div><!-- .entry-content -->
		<div style="clear:both"></div>
		<footer class="entry-meta">
			<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
		</footer><!-- .entry-meta -->
	</article><!-- #post-<?php the_ID(); ?> -->
	<?php endwhile; // end of the loop. ?>
</div><!--/.mainrpage-->

					<?php //comments_template( '', true ); ?>

				

			</div><!-- #content -->
		</div><!-- #primary -->
<?php get_footer(); ?>